import AsyncStorage from '@react-native-async-storage/async-storage';
export default class Storage{
    // 移除本地存储信息
    /*
        事例：Storage.removeValue('logininfo');
    */
    static async removeValue(key){
        try {
            await AsyncStorage.removeItem(key)
        } catch(e) {
        }
    }
    // 获取存储信息(异步操作)
    /*
        事例：Storage.getStoreData('logininfo').then((res)=>{
            console.log(res);
        })
    */
    static async getStoreData(key){
        try {
            const value = await AsyncStorage.getItem(key);
            return value;
        } catch(e) {
            return e;
        }
    }
    // 本地存储信息
    /*
        事例：Storage.storeData('logininfo',JSON.stringify(res));
    */
    static async storeData(key,value){
        try {
            await AsyncStorage.setItem(key, value);
        } catch (e) {
            // saving error
        }
    }


}